package com.howlaisi.sms.student.exception;

import com.howlaisi.common.result.Result;
import com.howlaisi.common.result.ResultCode;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author 张师傅
 * @date 2024/9/9
 */
@RestControllerAdvice
public class StudentExceptionHandler {
    @ExceptionHandler(Exception.class)
    public Result handleException(Exception e) {
        e.printStackTrace();
        return Result.failed(ResultCode.SYSTEM_EXECUTION_ERROR);
    }
    @ExceptionHandler(StudentException.class)
    public Result handleStudentNotExistException(StudentException e) {
        return Result.failed(ResultCode.STUDENT_NOT_EXIST);
    }
}
